import http from "@/api";
import { ListQueryParams, ISubmitRole, IRoleList, IRole } from "@/api/interface/role";

// * 获取全部菜单列表
export const getRoleList = (params: ListQueryParams) => {
	return http.get<IRoleList>({
		url: `/role/getRoleList`,
		params
	});
};

// * 获取全部菜单列表
export const getAllRoleList = () => {
	return http.get<IRole[]>({
		url: `/role`
	});
};

// * 创建权限
export const createRole = (role: ISubmitRole) => {
	return http.post({
		url: `/role`,
		data: role
	});
};

// * 修改权限
export const updateRole = (role: ISubmitRole) => {
	return http.patch({
		url: `/role/${role.id}`,
		data: role
	});
};

// * 删除权限
export const deleteRole = (id: number) => {
	return http.delete({
		url: `/role/${id}`
	});
};
